package sys.news.service.impl;

import sys.news.dao.CommentsDao;
import sys.news.dao.impl.CommentsDaoImpl;
import sys.news.pojo.Comments;
import sys.news.service.CommentsService;

import java.util.List;

public class CommentsServiceImpl implements CommentsService {
    private CommentsDao commentsDao =new CommentsDaoImpl();
    /**
     * 新增评论
     *
     * @param comments
     * @return
     */
    @Override
    public boolean addComments(Comments comments) {
        return commentsDao.addComments(comments) == 1?true:false;
    }

    /**
     * 删除评论
     *
     * @param
     * @return
     */
    @Override
    public boolean delComments(int cid) {
        return commentsDao.delComments(cid) == 1?true:false;
    }

    /**
     * 查询所有评论
     *
     * @return
     */
    @Override
    public List<Comments> getAll() {
        return commentsDao.getAll();
    }

    /**
     * 修改评论
     *
     * @param comments@return
     */
    @Override
    public boolean updateComments(Comments comments) {
        return commentsDao.addComments(comments) == 1?true:false;
    }
}
